<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>绑定账号{if condition="$seoconfig.seo_title neq ''"}-{$seoconfig.seo_title}{/if}</title>
	<meta name="keywords" content="{$seoconfig.seo_meta}" />
	<meta name="description" content="{$seoconfig.seo_desc}"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<link rel="shortcut  icon" type="image/x-icon" href="__TEMP__/{$style}/public/images/favicon.ico" media="screen"/>
	<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/showbox.css">
	<link rel="stylesheet" href="__TEMP__/{$style}/public/css/login_base.css">
	<link rel="stylesheet" href="__TEMP__/{$style}/public/css/login_wap.css">
	<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/showbox.css">
	<style type="text/css">
		body{ font-family: "Helvetica Neue", "Microsoft YaHei", Helvetica, STHeiTi, 微软雅黑, sans-serif; }
		.content{max-width: 648px;margin:auto;}
		.reg-box{ width: 90%; }
		.reg-box .reg-cont label{ width: 100%;margin-left: 0%; }
		.reg-box .reg-cont label span,.reg-box .nk-cont label span{ width: 70px;display: inline-block; }
		.reg-box .lang-btn,.reg-box .nk-cont{ width: 100%;margin-left: 0%; }
		.tit-info{ width: 92%;margin: 20px auto; }
		.tit-info .h3{ font-size: 16px;color: #333;}
		.tit-info p{ font-size:12px;color: #999; margin-top: 3px;}
		.footer { margin: 100px 0 0 0;padding: 0;min-height: 1px;text-align: center;line-height: 16px;background-color: #fff; }
		.ft-copyright { padding: 50px 0 20px;margin: 0 15px;font-size: 12px;background: url("__TEMP__/{$style}/public/images/logo_copy.png") no-repeat center 15px;background-size: 110px 30px;}
		.ft-copyright a { padding-top: 45px; color: #ccc;}
	</style>
</head>
<body>
	{include file='wap/default_new/urlModel'/}
	<!-- showBox弹出框 -->
	<div class="motify" style="display: none;">
		<i class="show_type warning"></i>
		<div class="motify-inner">{:lang('pop_up_prompt')}</div>
	</div>

	<div class="content">
		<div class="tit-info">
			<div class="h3">登录已有账号进行绑定</div>
			<p>绑定已有账号信息，您可以直接把第三方登录的用户信息与您已经注册过的账号进行绑定</p>
		</div>
		<div class="reg-box">
			<div class="reg-cont">
				<label class="login-txt" for="username">
					<span>{:lang('account_number')}</span>
					<input class="" type="text" name="username" id="username" placeholder="{:lang('enter_your_account_number')}">
				</label>
			</div>
			<div class="reg-cont">
				<label for="password">
					<span>{:lang('password')}</span>
					<input class="" type="password" name="password" id="password" placeholder="{:lang('please_input_password')}" >
				</label>
			</div>
			{if condition="$code_config['pc'] eq 1"}
			<div class="nk-cont" >
				<label>
					<span style="color: #333;">{:lang('member_verification_code')}</span>
					<input type="text" name="captcha" id="captcha"  placeholder="{:lang('please_enter_verification_code')}" maxlength="4">
			        <img class="verifyimg" style="width:75px!important;float: right;margin: 11px 4px;" src=" {:__URL('SHOP_MAIN/captcha')}" onclick="this.src='{:__URL('SHOP_MAIN/captcha')}'"  alt="captcha" style="vertical-align: middle; cursor: pointer; height: 35px;" />
		        </label>
			</div>
		   	{/if}
			
			<button id="login-button" class="lang-btn" onclick="loginBind()" style="margin-top: 20px;">登录绑定</button>
			<a href="{:__URL('APP_MAIN/login/perfectInfo')}"><button class="lang-btn register_immediately">没有账号</button></a>
		
		</div>
	</div>

	<div class="footer" style="min-height: 86px;" id="rigister_copyright">
		<div class="copyright">
			<div class="ft-copyright">
				<a href="http://www.niushop.com.cn" target="_blank" >山西牛酷信息科技有限公司&nbsp;提供技术支持</a>
			</div>
		</div>
	</div>

	<script src="__TEMP__/{$style}/public/js/showBox.js"></script>
	<script src="__TEMP__/{$style}/public/js/jquery.js"></script>
	<script src="__STATIC__/js/load_bottom.js" type="text/javascript"></script>
	<script type="text/javascript">
		var APPMAIN='APP_MAIN';
		var STATIC = "__STATIC__";
		var is_sub = false; // 防止重复提交
		function loginBind(){
			var username = $("#username").val(),
				pass = $("#password").val(),
				verify_code = $("#captcha").val();
				if(vertify(username, pass, verify_code)){
					if(is_sub) return;
					is_sub = true;
					$.ajax({
						type : "post",
						url : "{:__URL('APP_MAIN/login/bindAccount')}",
						data : {
							"username" : username,
							"password" : pass,
							"captcha" : verify_code
						},
						success : function(data){
							if(data["code"] > 0){
								showBox(data['message'], "success", "{:__URL('APP_MAIN/member/index')}");
							}else{
								is_sub = false;
								showBox(data['message'], "error");
							}
						}
					})
				}
		}

		function vertify(username, pass, verify_code){
			if(username.length == 0){
				$("#username").focus();
				showBox("请输入用户名", "error");
				return false;
			}
			if(pass.length == 0){
				$("#password").focus();
				showBox("请输入密码", "error");
				return false;
			}
			{if condition="$code_config['pc'] eq 1"}
			if(verify_code.length == 0){
				$("#captcha").focus();
				showBox("请输入验证码", "error");
				return false;
			}
			{/if}
			return true;
		}
	</script>
</body>
</html>